In [ ]:
from flightanalysis import Section, get_schedule

from flightplotting.plots import plotsec, plotdtw
from __future__ import print_function
from ipywidgets import interact
from plotly.offline import iplot
import plotly
plotly.offline.init_notebook_mode()


def nbdisplay(fig, w=800, h=600, z=1.9):
    fig.update_layout(
        width=w,
        height=h,
        scene_camera=dict(
            up=dict(x=0, y=0, z=1),
            center=dict(x=0, y=0, z=-0.2),
            eye=dict(x=0.0, y=-z, z=-0.8),
            projection=dict(type='perspective')
        )
    )
    return fig
In [ ]:
flown = Section.from_flight(
    "data/logs/flight_csvs/00000100.csv", "data/flightlines/gordano_box.json").subset(107, 505)

p21 = get_schedule("F3A", "P21")
template = p21.scale_distance(170).create_raw_template("left", 50.0, 170.0)
In [ ]:
distance, aligned = Section.align(flown, template, 2)

nbdisplay(plotdtw(aligned, p21.manoeuvres), w=800, h=500, z=1.3).show()
In [ ]:
#
#@interact(i=(0,17))
#def plotdt(i):
#    man = p21.manoeuvres[i]
#    fig = nbdisplay(plotdtw(man.get_data(aligned), man.elements), w=1200, h=500, z=2.2)
#    iplot( fig)
In [ ]:
intended = p21.match_intention(aligned).correct_intention()

scaled_template =  intended.create_matched_template(aligned)
In [ ]:
@interact(i=(1,17))
def plotdt(i):
    man = p21.manoeuvres[i-1]
    fig = plotsec(man.get_data(aligned), 5, 10, color="orange")
    fig = plotsec(man.get_data(scaled_template), 5, 10, color="red", fig=fig)
    fig = nbdisplay(fig, w=800, h=400, z=2.2)
    iplot(fig)
In [ ]: